package celular;

import celular.cadastrar.FormCadastrarUsuario;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.TextField;

public class FormLoginInvalido extends Form implements CommandListener {

	private Command commandEscolha;
	private Main main;
	private ChoiceGroup choiseEscolha;	
	
	private String [] escolha = {"Nao","Sim"};

	public FormLoginInvalido(String titulo, Main main)
	{
		
		super(titulo);
		
		this.main = main;
		this.commandEscolha = new Command("escolha", Command.OK, 0);	

		addCommand(this.commandEscolha);
	
		append(this.choiseEscolha = new ChoiceGroup("Deseja se cadastrar :",Choice.EXCLUSIVE,escolha, null));
		
		
		setCommandListener(this);   
		
		
	}
	
	public void commandAction(Command c, Displayable d)
	{
		if (c == this.commandEscolha) {
			if (this.choiseEscolha.getSelectedIndex() == 0)				
			        this.main.getTela().setCurrent(new FormLogin("Login", this.main));
			else
				this.main.getTela().setCurrent(new FormCadastrarUsuario("Cadastrar Usuario",this.main, this));
		}
		
	}
	

}
